<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Product</title>
</head>
<body>
<table border="1" cellpadding="10px" cellspacing="0" align="center">
    <tr>
    <th>Product ID</th>
    <th>Name</th>
    <th>Price</th>
    <th>Quantity</th>
    <th>Show</th>                
    </tr>
<?php
$connection = mysql_connect("localhost", "root", "");
		if ( !$connection ) {
			die('Could not connect to localhost.');	
		}
		$db = mysql_select_db("test", $connection);
		if ( !$db) {
			die ('Could not find database test.');	
		}
		
		$pro = "select * from products";
		$result = mysql_query($pro,$connection);
		
		while ($row = mysql_fetch_array($result)) {
			echo "<tr>";
			echo "<td>" . $row['id'] . "</td>";
			echo "<td>" . $row['product_name'] . "</td>";
			echo "<td>" . $row['product_price'] . "</td>";
			echo "<td>" . $row['product_quantity'] . "</td>";
			echo "<td>" .$idFilename. "</td>";			
			echo "</tr>";										
		}
		mysql_close($connection);		
?>
</table>
<p>
</p>
<p>
<form action="add.php" method="post">
	<table border="1"  cellpadding="10px" cellspacing="0" align="center">
    <tr>
    <th>Please Enter the Product ID to buy:</th>
    <td>
    <input type="text" name="add" size="9" /> 
    </td>
    </tr>
    <tr>
    <th>Please Enter the number of products:</th>
    <td>
    <input type="text" name="num" size="9" /> 
    </td>
    </tr>
	<tr>
    <th><input type="submit" name="submit" value="Buy" /></th></tr>
</table>
</form>
</p>
</body>
</html>